﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using PayrollSystemLibrary;
using PayrollSystemLibrary.Model;

namespace UnitTestPayrollLibrary.EmployeeEntity
{
    [TestClass]
    public class GivenInvalidEmployee
    {
        [TestMethod]
        public void WhenValidating_ThenResultShouldContainMessage()
        {
            var emp = CreateInValidHourlyEmp();

            var result = new EmployeeHelper().Validate(emp);

            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsValid);
            Assert.IsNotNull((result.ValidationResult));
            Assert.IsTrue(result.ValidationResult.Count==1);

        }

        private Employee CreateInValidHourlyEmp()
        {
            var emp = new Employee();
            emp.Adress = "dummy";
            emp.BankAccount = "dummy";
            emp.BankName = "dummy";
            emp.Classification = "H";
            emp.EmpId = 1;
            emp.HourlyRate = 8;
            emp.IsAffiliated = false;
           
            emp.PaymentMethod = "H";
            emp.PaymentSchedule = "W";
            return emp;
        }
    }
}
